package com.demo.hello.annotation;

import com.demo.hello.decoupling.HelloWorldMessageProvider;
import com.demo.hello.decoupling.MessageProvider;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 描述：
 *
 * @author lida
 * @time 2019/10/11 10:33
 */
public class HelloWorldAnnotated {

	public static void main(String[] args) {
		//包路径扫描,会扫描test包下的bean
		//ApplicationContext ac = new AnnotationConfigApplicationContext("com.demo.hello.annotation");
		//配置类扫描的方式,此时不会扫描test包下的bean
		ApplicationContext ac = new AnnotationConfigApplicationContext(HelloWorldConfiguration.class);
		MessageProvider me = ac.getBean("p", MessageProvider.class);
		System.out.println(me instanceof HelloWorldMessageProvider);

	}
}
